# :irc.opera.com 332 test_ #test :testing in here!

set RECV_LISTEN(332) m_332
set RECV_LISTEN(TOPIC) m_topic

proc m_332 {chid raw parent me} {
	regexp {:[^ ]+ 332 [^ ]+ ([^ ]+) :(.+)} $raw -> channel topic
	
	set view [getchan $channel]
	$view.topic configure -text "[tr {Channel topic is}]: $topic"
	f_output $view.mainbox.output "*** [tr {Channel topic is}]: $topic\n" darkgreen
}

proc m_topic {chid raw parent me} {	
	regexp {:([^ ]+) TOPIC ([^ ]+) :(.+)} $raw -> nick channel topic
	regexp {:([^!]+)![^ ]+ TOPIC ([^ ]+) :(.+)} $raw -> nick channel topic
	
	set view [getchan $channel]
	$view.topic configure -text "[tr {Channel topic is}]: $topic"
	f_output $view.mainbox.output "*** $nick [tr \"has set topic to be\"]: $topic\n" darkgreen
}
